﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Profile.aspx.vb" Inherits="LFC_photosharing.Profile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <h2>
        You Are Viewing Profile</h2>
        
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
        ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
        
        SelectCommand="SELECT [ID], [FirstName], [LastName], [Description], [Picture], [TravellerName], [DoB], [LastUploadDate] FROM [Profile] WHERE ([TravellerName] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="TravellerName" QueryStringField="TravellerName" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1" 
        Height="50px" Width="125px" AutoGenerateRows="False">
        <Fields>
            <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="LastName" 
                SortExpression="LastName" />
            <asp:BoundField DataField="Description" HeaderText="Description" 
                SortExpression="Description" />
            <asp:BoundField DataField="TravellerName" HeaderText="UserName" 
                SortExpression="TravellerName" />
            <asp:ImageField DataImageUrlField="Picture" HeaderText="Picture">
                <ControlStyle CssClass="image" />
            </asp:ImageField>
            <asp:BoundField DataField="DoB" HeaderText="DoB" SortExpression="DoB" />
            <asp:BoundField DataField="LastUploadDate" HeaderText="LastUploadDate" 
                SortExpression="LastUploadDate" />
        </Fields>
    </asp:DetailsView>
    <br />
    <asp:Button ID="btn_editProfile" runat="server" 
        PostBackUrl="~/editProfile.aspx" Text="Edit Profile" />
    <asp:Button ID="btn_changePassword" runat="server" 
        PostBackUrl="~/Account/ChangePassword.aspx" Text="Change Password" />
    <div style="position: relative; top: -356px; left: 490px; width: 400px;overflow:auto;height:300px">
        <h3>Pictures uploaded by this User</h3><br />
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
            DataSourceID="SqlDataSource2">
            <AlternatingItemTemplate>
                <span style="background-color: #FFFFFF;color: #284775;">
                <a href='PhotoDetails.aspx?ID=<%# Eval("ID") %>'>
                <img src='<%# Eval("Picture") %>' style="height:150px;width:150px"/></a></span>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <span style="background-color: #999999;">Picture:
                <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                <br />
                Author:
                <asp:TextBox ID="AuthorTextBox" runat="server" Text='<%# Bind("Author") %>' />
                <br />
                PhotoName:
                <asp:TextBox ID="PhotoNameTextBox" runat="server" 
                    Text='<%# Bind("PhotoName") %>' />
                <br />
                UploadDate:
                <asp:TextBox ID="UploadDateTextBox" runat="server" 
                    Text='<%# Bind("UploadDate") %>' />
                <br />
                ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br /><br /></span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No Picture was Uploaded by this User.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style="">Picture:
                <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                <br />Author:
                <asp:TextBox ID="AuthorTextBox" runat="server" Text='<%# Bind("Author") %>' />
                <br />PhotoName:
                <asp:TextBox ID="PhotoNameTextBox" runat="server" 
                    Text='<%# Bind("PhotoName") %>' />
                <br />UploadDate:
                <asp:TextBox ID="UploadDateTextBox" runat="server" 
                    Text='<%# Bind("UploadDate") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br /><br /></span>
            </InsertItemTemplate>
            <ItemTemplate>
                <span style="background-color: #E0FFFF;color: #333333;">
                <a href='PhotoDetails.aspx?ID=<%# Eval("ID") %>'>
                <img src='<%# Eval("Picture") %>' style="height:150px;width:150px"/></a></span>
            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" 
                    style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                <div style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF;">
                    <asp:DataPager ID="DataPager1" runat="server">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                ShowLastPageButton="True" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="background-color: #E2DED6;font-weight: bold;color: #333333;"><a href='PhotoDetails.aspx?ID=<%# Eval("ID") %>'>
                <img src='<%# Eval("Picture") %>' style="height:150px;width:150px"/></a></span>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:KOPConn %>" 
            ProviderName="<%$ ConnectionStrings:KOPConn.ProviderName %>" 
            SelectCommand="SELECT [Picture], [Author], [PhotoName], [UploadDate], [ID] FROM [Photolist] WHERE ([Author] = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Author" QueryStringField="TravellerName" 
                    Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
</asp:Content>
